package Multithreading.Exercise006;

import java.util.ArrayList;
import java.util.concurrent.Callable;

/**
 * ClassName:MyRunnable
 * Package:Multithreading.Exercise006
 * Description:
 *
 * @Author:ZhangXin
 * @Create:2023/3/6-23:07
 * @Version:v1.0
 */
public class MyCallable implements Callable<ArrayList<String>> {

    @Override
    public ArrayList<String> call() throws Exception {
        ArrayList<String> list = new ArrayList<>();
        synchronized (MyCallable.class) {

            for (int i = 100; i > 0; i--) {
                if (i % 2 == 0) {
                    continue;
                } else {
                    list.add(Thread.currentThread().getName() + i);
                }
            }
        }

        return list;
    }
}
